/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/classic_grid_main_menu_popup.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */

/* Makes the main menu popup apper in grid-like format that somewhat resembles the menu from Australis styling */

/* Basic styling */
#appMenu-mainView{ max-width: initial !important; }

#appMenu-mainView > .panel-subview-body{
  display: flex; 
  flex-direction: row; 
  max-width: 290px;
  height: 466px !important;
  /* Raise this if you see scrollbar in the popup. Popup height depends on font-size */
  max-height: none !important;
  flex-wrap: wrap;
  padding-bottom: 0px !important;
  align-content: end;
}

#appMenu-mainView > .panel-subview-body > toolbarseparator{
  min-width: 250px;
  flex-grow:1;
  margin-inline: 0 !important;
}
#appMenu-mainView > .panel-subview-body > toolbaritem{ flex-grow: 1 }
:where(#appMenu-mainView) > .panel-subview-body > toolbarbutton{
  width: 70px;
  height: 76px;
  flex-grow:1;
}
#appMenu-mainView > .panel-subview-body > toolbarbutton > .toolbarbutton-icon{
  -moz-box-flex: 1;
}
#appMenu-mainView > .panel-subview-body > toolbarbutton{
  flex-direction: column;
}

:where(#appMenu-mainView) > .panel-subview-body > toolbarbutton.subviewbutton{
  padding-inline: 4px !important;
  margin-inline: 8px !important;
  fill: currentColor;
}

#appMenu-mainView > .panel-subview-body > .subviewbutton > .toolbarbutton-text{
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 70px;
}

/* Unique styling for Edit and Zoom controls */

#appMenu-zoom-controls,
#appMenu-zoom-controls + toolbarseparator{
  order: -1;
  height: initial !important;
  margin: initial !important;
  flex-grow: 1;
  width: 280px;
}
#appMenu-fullscreen-button2{
  padding-inline: var(--arrowpanel-menuitem-padding) !important;
  margin-inline: var(--arrowpanel-menuitem-padding) !important;
}
#appMenu-zoom-controls + toolbarseparator{ margin-block: 0 4px !important; }
#appMenu-zoom-controls{ padding-block: 2px !important; }
#appMenu-zoom-controls > :not(:last-child){
  flex-grow: 1 !important;
  justify-content: center !important;
  border-radius: 0 !important;
}
#appMenu-zoomReset-button2{
  border-inline: 1px solid var(--panel-separator-color) !important;
}
/* Reorder separators & "special" items */

#appMenu-fxa-separator{
  margin-block: 0 -1px !important;
}
#appMenu-fxa-separator,
#appMenu-fxa-status2{ order: 3; }

#appMenu-extensions-themes-button + toolbarseparator{
  order: 3;
  margin-block: 0 -1px !important;
}

/* Full-row items should have contents laid out horizontally */
#appMenu-update-banner,
#appMenu-fxa-status2,
#appMenu-fxa-label2{ -moz-box-orient: horizontal !important; }

#appMenu-addon-banners > .addon-banner-item{
  margin: 0px !important;
}

/* "Main" items styling */
#appMenu-update-banner,
#appMenu-fxa-status2,
#appMenu-more-button2.subviewbutton,
#appMenu-quit-button2.subviewbutton,
#appMenu-help-button2.subviewbutton{
  order: 3;
  margin: initial !important;
  height: unset !important;
  padding-inline: 0 !important;
  width: initial;
}

/* Set minimum width for "full-row" items */
#appMenu-fxa-status2,
#appMenu-fxa-separator{
  width: 280px; 
}

#appMenu-update-banner,
#appMenu-quit-button2.subviewbutton{ order: 4 }

#appMenu-more-button2 > .toolbarbutton-icon{
  -moz-box-flex: 0 !important;
}
/* Color styling for items */

#appMenu-mainView > .panel-subview-body toolbarbutton:not([disabled]):hover{
  box-shadow: inset 0 0 3px 0px var(--button-bgcolor);
}

#appMenu-update-banner{ border-inline-end: 1px solid var(--panel-separator-color) !important; }
#appMenu-help-button2{ border-inline: 1px solid var(--panel-separator-color) }

/* Hide some additional items */
#appMenu-fxa-text,
#appMenu-help-button2 + toolbarseparator,
#appMenu-new-private-window-button2 + toolbarseparator,
#appMenu-zoom-controls > #appMenu-fullscreen-button > label,
#appMenu-zoom-controls > label,
#appMenu-zoom-controls > spacer,
#appMenu-edit-controls2 > label,
#appMenu-edit-controls2 > spacer,
#appMenu-mainView > .panel-subview-body > toolbarbutton::after{ display: none !important; }

/* Sync styling */

#appMenu-fxa-label2{
  margin: 0 !important;
  padding: 0 !important;
  font-size: 1em !important;
}
#appMenu-fxa-status2{
  display: grid !important;
  padding-block: 0 !important;
  justify-content: stretch !important;
}
#appMenu-fxa-status2 > *{ grid-area: 1/1 }
#appMenu-fxa-status2 > toolbarbutton::before,
#appMenu-protonMainView > .panel-subview-body > toolbarbutton > image{
  fill: currentColor;
  -moz-context-properties: fill;
}

#appMenu-fxa-status2 > toolbarbutton::before{
  display: flex;
  content: "";
  width: 16px;
  height: 16px;
  margin-inline: 8px;
  background-image: var(--avatar-image-url)
}

#appMenu-more-button2 > .toolbarbutton-icon{ margin-inline: 8px !important; }
#appMenu-update-banner > .toolbarbutton-text,
#appMenu-help-button2 > .toolbarbutton-text,
#appMenu-quit-button2 > .toolbarbutton-text{
  display: none !important;
}
#appMenu-update-banner,
#appMenu-fxa-label2,
#appMenu-more-button2,
#appMenu-help-button2,
#appMenu-quit-button2{
  background-color: var(--button-bgcolor) !important;
  border-radius: 0 !important;
  flex-direction: row !important;
  justify-content: center !important;
  padding-block: 12px !important;
  opacity: 0.8;
}

#appMenu-more-button2{
  min-width: 170px;
  justify-content: start !important;
}

#appMenu-update-banner:hover,
#appMenu-fxa-label2:hover,
#appMenu-more-button2:hover,
#appMenu-help-button2:hover{
  opacity: 1;
}
#appMenu-update-banner{ background-color: rgb(120,180,120) !important; }
#appMenu-quit-button2:hover{ background-color: rgb(220,100,100) !important; }

/* Missing icons */
#appMenu-update-banner{ list-style-image: url("chrome://global/skin/icons/reload.svg"); }
#appMenu-new-tab-button2{ list-style-image: url("chrome://browser/skin/new-tab.svg") }
#appMenu-new-window-button2{ list-style-image: url("chrome://browser/skin/window.svg") }
#appMenu-new-private-window-button2{ list-style-image: url("chrome://browser/skin/privateBrowsing.svg") }
#appMenu-bookmarks-button{ list-style-image: url("chrome://browser/skin/bookmark-star-on-tray.svg") }
#appMenu-history-button{ list-style-image: url("chrome://browser/skin/history.svg") }
#appMenu-downloads-button{ list-style-image: url("chrome://browser/skin/downloads/downloads.svg") }
#appMenu-passwords-button{ list-style-image: url("chrome://browser/skin/login.svg") }
#appMenu-extensions-themes-button{ list-style-image: url("chrome://mozapps/skin/extensions/extension.svg") }
#appMenu-translate-button{ list-style-image: url("chrome://browser/skin/translations.svg") }
#appMenu-print-button2{ list-style-image: url("chrome://global/skin/icons/print.svg") }
#appMenu-save-file-button2{ list-style-image: url("chrome://browser/skin/save.svg") }
#appMenu-find-button2{ list-style-image: url("chrome://global/skin/icons/search-glass.svg") }
#appMenu-settings-button{ list-style-image: url("chrome://global/skin/icons/settings.svg") }
#appMenu-more-button2{ list-style-image: url("chrome://global/skin/icons/developer.svg") }
#appMenu-report-broken-site-button{ list-style-image: url("chrome://global/skin/icons/warning.svg") }
#appMenu-help-button2{ list-style-image: url("chrome://global/skin/icons/info.svg") }
#appMenu-quit-button2{ list-style-image: url("chrome://devtools/skin/images/search-clear.svg"); stroke: transparent; -moz-context-properties: fill,stroke }